{extend name="base" /}
{block name="header"}
    <style>
        .footer {
            display: none;
        }
    </style>


{/block}
{block name="body"}

    <div class="bottom-bar-global bottom-bar-container" style="transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1); bottom: 0px; position: fixed;">

        <div class="bottom-bar-btn download-doc-btn">
            <a href="javascript:void(0);"><span class="primary-text"><img src="__IMAGES__/icon-collect.png" alt="">收藏</span></a>
        </div>
        <div class="bottom-bar-btn pay-vip-btn">
            <a {eq name='$user_info' value=''}href="{:url('/login')}"{else} onClick='downdoc({$item.id})' href="javascript:void(0);"{/eq}>
                <span class="primary-text"><img src="__IMAGES__/icon-xiazai.png" alt="">下载资源</span>
                <span class="sub-text">加入会员免费下载</span>
            </a>
        </div>
    </div>

    <div class="doctopic" style="padding: 5px">
        <h1 title="{$item.title}" style="font-size:24px">{$item.title}</h1>
    </div>

    <a id="ui-back" style="bottom: 60px; font-size:14px;" class="touch-btn-page" target="_self" href="javascript:history.back(-1);">返回</a>
    <a style="bottom: 60px; font-size:14px;" class="touch-btn-relate" target="_self" href="#">举报</a>

    <div class="svg-page">
        {$item | showPreviewImage | raw}
    </div>

    <div id="pageMore">亲，该文档总共{$item.total_page}页，到这儿已超出免费预览范围，如果喜欢就下载吧！</div>

    <div style="margin-top:20px;padding: 10px">
        <div style="font-size: 16px; background-color:#e5f0f7; font-weight: bold; text-indent:10px; line-height: 40px; height:40px; padding-bottom: 0px; margin-bottom:10px;">资源描述</div>
        <div class="detail-article" >
            {$item.content | raw}
            <p>《{$item.title}》由会员分享，可在线阅读，更多相关《{$item.title}》请在{web name='site_title' /}上搜索。</p>
            <p>1. 部分包含数学公式或PPT动画的文件，查看预览时可能会显示错乱或异常，文件下载后无此问题，请放心下载。</p>
            <p>2. 本文档由用户上传，版权归属用户，{$site_info.site_title}负责整理代发布。如果您对本文档版权有争议请及时联系客服。</p>
            <p>3. 下载前请仔细阅读文档内容，确认文档内容符合您的需求后进行下载，若出现内容与标题不符可向本站投诉处理。</p>
            <p>4. 下载文档时可能由于网络波动等原因无法下载或下载错误，付费完成后未能成功下载的用户请联系客服处理。 </p>
            <p>网站客服QQ: {$site_info.qq}</p>
        </div>
        <div class="readMore" onclick="showMore()" style="background-color:transparent; height:auto; margin:0px 0px; padding:20px 0px 0px 0px;">
            <span class="btn-readMore" style="background-color:transparent;">
                <em style=" font-style:normal">展开</em>阅读全文<i></i>
            </span>
        </div>

    </div>

    <div style=" font-size: 16px; background-color:#e5f0f7; margin-top:20px;  font-weight: bold; text-indent:10px; line-height: 40px; height:40px; padding-bottom: 0px; margin-bottom:10px;">相关搜索</div>
    <div class="widget-box pt0" style="border: none;padding: 5px ">
        <ul class="taglist--inline multi">
            {random_doc_list limit="8" cid="$item['cid']"}
            <li class="tagPopup">
                <a class="tag tagsearch" href="{:url('/zy-' . $item.id)}" title="{$item.title}">{$item.title}</a>
            </li>
            {/random_doc_list}
        </ul>
    </div>

{/block}

{block name='footer'}
<script type="text/javascript">
        //下载文档
        function downdoc(id)
        {
            $.ajax({
                type: "POST",
                url: "/download",
                data: {
                    'id' : id
                },
                dataType: "json",
                success: function(res) {
                    if (res.code == 200) {
                        window.open(res.data);
                        //  location.href = res.data;
                    }
                }
            })
        }

        function showMore()
        {
            $(".readMore").hide();
            $(".detail-article").css({
                "height":"auto",
                "overflow": "hidden"
            });
        }
        $(document).ready(function() {
            var dh = $(".detail-article").height();
            if(dh >100)
            {
                $(".detail-article").css({
                    "height":"100px",
                    "overflow": "hidden"
                });
            }
            else
            {
                $(".readMore").hide();
            }

        });

        function relate() {
            var reltop = $('#relate').offset().top-50;
            $("html,body").animate({ scrollTop: reltop }, 500);
        }

        $(document).ready(function () {
            $('.bottom-bar-global').show();
            $('.bottom-bar-global').css({
                bottom: 0
            });
        });


        $(document).ready(function () {

            var UA = navigator.userAgent.toLowerCase();
            var isbaidu = 0;
            try {
                isbaidu = UA.indexOf('baidu') > -1;
            } catch (e) { }
            if (isbaidu) {
                $('.bottom-bar-global').css(
                    { top: $(window).height() - 50 }
                );
                $(window).scroll(function () {
                    //开始监听滚动条

                    //获取当前滚动条高度
                    var height = $(window).height();
                    var topp = $(document).scrollTop();
                    $('.bottom-bar-global').css({
                            top: (height + topp - 50)
                        }
                    );
                });
            }
            else {
                $('.bottom-bar-global').css(
                    { position: "fixed" }
                );
            }
        });
    </script>
{/block}

